import java.util.Scanner;
public class GuessNumber {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (true) {
            int answer = (int) (Math.random() * 100) + 1;
            System.out.println("请输入一个1-100之间的数字");
            int guess = 0;
            int time = 0;
            while (time < 7) {
                guess = scanner.nextInt();
                time++;
                if (answer > guess) {
                    System.out.println("小了");
                } else if (answer < guess) {
                    System.out.println("大了");
                } else {
                    System.out.println("猜对了");
                    break;
                }
            }
            if (time == 7 && answer != guess) {
                System.out.println("真可惜，次数用完了");
            }
            System.out.println("在玩一次(y/n)");
            String choice = scanner.next();
            if (!choice.equalsIgnoreCase("y")) {
                break;
            }
        }
    }
}
